import type { ProColumns } from '@ant-design/pro-table';

// 定义请求返回数据类型
export type ColumnsItem = {
  custNo: string;
  email: string;
  telNo: string;
  journalNo: string;
  custStatus: string;
  status: string;
  reason: string;
}

// 定义表头
let columnsData: ProColumns<ColumnsItem>[] = [
  {
    title: '商户号',
    hideInTable: true,
    dataIndex: 'custNo',
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '重置结果',
    dataIndex: 'status',
    hideInTable: true,
    valueType: 'select',
    valueEnum: {
      0: { text: '已重置', status: 'Success' },
      1: { text: '拒绝', status: 'Error' }
    },
  },
  {
    title: '申请编号',
    dataIndex: 'journalNo',
    hideInTable: true,
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '申请日期',
    dataIndex: 'created_at',
    hideInTable: true,
    valueType: 'dateRange',
    search: {
      transform: (value) => {
        return {
          startDate: value[0],
          endDate: value[1],
        };
      },
    },
  },

  // 上方查询，下方表头
  {
    title: '序号',
    dataIndex: 'index',
    valueType: 'indexBorder',
    width: 50,
    fixed: 'left',
  },
  {
    title: '商户号',
    hideInSearch: true,
    dataIndex: 'custNo',
    ellipsis: true,
    width: 160,
    fixed: 'left',
  },
  {
    title: '手机号',
    hideInSearch: true,
    dataIndex: 'telNo',
    ellipsis: true,
    width: 120,
  },
  {
    title: '邮箱',
    hideInSearch: true,
    dataIndex: 'email',
    width: 200,
  },
  {
    title: '申请编号',
    hideInSearch: true,
    dataIndex: 'journalNo',
    width: 160,
  },
  {
    title: '商户状态',
    hideInSearch: true,
    dataIndex: 'custSstatus',
    width: 120,
    valueEnum: {
      0: { text: '正常', status: 'Success' },
      1: { text: '冻结', status: 'Error' },
      2: { text: '注销', status: 'Default' },
      3: { text: '未激活', status: 'Default' },
    },
  },
  {
    title: '申请时间',
    dataIndex: 'createdTime',
    valueType: 'dateTime',
    width: 160,
    hideInSearch: true
  },
  {
    title: '重置结果',
    hideInSearch: true,
    width: 120,
    dataIndex: 'status',
    valueEnum: {
      0: { text: '已重置', status: 'Success' },
      1: { text: '拒绝', status: 'Error' }
    },
  },
  {
    title: '拒绝原因',
    width: 160,
    dataIndex: 'reason',
    hideInSearch: true
  },
]
export default columnsData;
